package com.whpost.admin.controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

public class BaseController {

    protected String rtnPath = "";

    public void setRtnPath(String rtnPath) {
        this.rtnPath = rtnPath;
    }

    /**
     * 查询页面
     * @return
     */
    @RequestMapping(value ="/query")
    public String query(){
        return rtnPath+"/query";
    }

    /**
     * 查询页面
     * @return
     */
    @RequestMapping(value ="/query_mx")
    public String queryMx(String zbid, Model model){
        model.addAttribute("zbid", zbid);
        return rtnPath+"/query_mx";
    }

    /**
     * 左右布局主页面
     * @return
     */
    @RequestMapping(value ="/main")
    public String main(){
        return rtnPath+"/main";
    }

    /**
     * 增改一体页面
     * @param id
     * @param lx 0 新增 1 修改
     * @param model
     * @return
     */
    @RequestMapping(value ="/info")
    public String info(String id, String lx,String pid, Model model){
        model.addAttribute("id", id);
        model.addAttribute("lx", lx);
        model.addAttribute("pid", pid);
        return rtnPath+"/info";
    }

    /**
     * 单独新增页面
     * @return
     */
    @RequestMapping(value ="/add")
    public String add(){
        return rtnPath+"/add";
    }

    /**
     * 单独修改页面
     * @return
     */
    @RequestMapping(value ="/update")
    public String update(){
        return rtnPath+"/update";
    }

}
